var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (n, i) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, n) {
              e.__proto__ = n;
            }) ||
          function (e, n) {
            for (var i in n)
              Object.prototype.hasOwnProperty.call(n, i) && (e[i] = n[i]);
          })(n, i);
      };
      return function (n, i) {
        function t() {
          this.constructor = n;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        e(n, i),
          (n.prototype =
            null === i
              ? Object.create(i)
              : ((t.prototype = i.prototype), new t()));
      };
    })(),
  GameSecenMainView = (function (e) {
    function n() {
      var n = e.call(this) || this;
      return (
        n.btn_fuben_main_back.on(
          Laya.Event.CLICK,
          n,
          n.onFuBenMainPageBackAction
        ),
        n.btn_fuben_main_shuoming.on(
          Laya.Event.CLICK,
          n,
          n.onDidLookFuBenShuoMingAction
        ),
        WebSocketService.addListener({
          caller: n,
          code: 1800,
          method: n.onLoadFuBenList,
        }),
        WebSocketService.addListener({
          caller: n,
          code: 1811,
          method: n.onLoadFuBenContinue,
        }),
        WebSocketService.addListener({
          caller: n,
          code: 1813,
          method: n.onLoadFuBenJiangLiAction,
        }),
        (n.list_game_fuben_list.vScrollBarSkin = ""),
        n.list_game_fuben_list.on(
          Laya.Event.CLICK,
          n,
          n.onDidClickFuBenListAction
        ),
        n.btn_fuben_lingqujiangli.on(
          Laya.Event.CLICK,
          n,
          n.onDidLookFuBenLingQuJiangLiAction
        ),
        n
      );
    }
    return (
      __extends(n, e),
      (n.showGameSecenView = function () {
        return (
          null == this.gameSecenMainView && (this.gameSecenMainView = new n()),
          WebSocketService.send({ c: 1800 }),
          (this.gameSecenMainView.list_game_fuben_list.visible = !1),
          this.gameSecenMainView
        );
      }),
      (n.prototype.onLoadFuBenList = function (e) {
        if (0 == e.code) {
          var n = void 0;
          if (null == e.data)
            return void WebSocketService.send({ c: 1811, d: { type: 2 } });
          e.more,
            (this.btn_fuben_lingqujiangli.visible = !0),
            (this.list_game_fuben_list.visible = !0);
          var i = [];
          this.isfbIngID = "-1";
          for (var t = e.data, o = 0; o < t.length; o++) {
            var a = t[o],
              s =
                a.title +
                "(" +
                a.lvl +
                "级 - " +
                Utils.getFuBenDropItem(a.type) +
                ")";
            1 == a.fbIng && (s = a.title + "(" + a.lvl + "级) - (进行中)"),
              this.isfbIngID != a.id &&
                ((n = {
                  btn_gameSence_huanjinqiyi: { label: s },
                  id: a.id,
                  site_id: a.site_id,
                  fbIng: a.fbIng,
                }),
                i.push(n)),
              1 == a.fbIng && (this.isfbIngID = a.id);
          }
          this.list_game_fuben_list.dataSource = i;
        }
      }),
      (n.prototype.onDidLookFuBenShuoMingAction = function () {
        this.removeSelf();
        var e = RulesView.showCaslRuleView("fubenshuoming");
        (e.y = 0), Laya.stage.addChild(e);
      }),
      (n.prototype.onDidClickFuBenListAction = function (e) {
        if ("" != e.target.name) {
          this.removeSelf();
          var n = this.list_game_fuben_list.selectedItem,
            i = { id: n.id };
          if (Global.roleLvl < n.lvl)
            ToastView.toastView("您的等级未达到该副本等级要求");
          else if (1 != n.fbIng) {
            var t = GameSecenPageView.showGameSecenPageView(i);
            t.pos(0, 35), Laya.stage.addChild(t);
          } else WebSocketService.send({ c: 1811, d: { type: 1 } });
        }
      }),
      (n.prototype.onFuBenMainPageBackAction = function () {
        this.removeSelf();
      }),
      (n.prototype.onLoadFuBenContinue = function (e) {
        ToastView.toastView(e.msg);
      }),
      (n.prototype.onDidLookFuBenLingQuJiangLiAction = function () {
        WebSocketService.send({ c: 1813 });
      }),
      (n.prototype.onLoadFuBenJiangLiAction = function (e) {
        ToastView.toastView(e.msg);
      }),
      (n.removeFuBenView = function () {}),
      n
    );
  })(ui.battlefield.GameSecenMainViewUI);
